package com.banksoft.cps.controller.company;

import com.banksoft.cps.bean.CompanyUser;
import com.banksoft.cps.bean.MonitorProduct;
import com.banksoft.cps.bean.query.CompanyUserQuery;
import com.banksoft.cps.bean.query.MonitorProductQuery;
import com.banksoft.cps.controller.ControllerConstants;
import com.banksoft.cps.enums.Status;
import com.banksoft.cps.service.MonitorProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by rongzhao.zhu on 2018/1/2.
 */
@Controller
@RequestMapping("/company/mProduct")
public class CMProductController extends ControllerConstants {

    @Autowired
    MonitorProductService monitorProductService;

    @RequestMapping(value = "listAll", produces = "application/json;charset=utf-8")
    @ResponseBody
    public String listAll(){
        MonitorProductQuery query = new MonitorProductQuery();
        query.setStatus(Status.valid.name());
        List<MonitorProduct> list =  monitorProductService.list(query);
        return toJSONString(createDataTip(list));
    }
}
